
R version 3.2.0 (2015-04-16) -- "Full of Ingredients"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> set.seed(51)
> # load(file = '~/Data/Medicare/Linked AQS-Medicare/HEI PM10 Accountability/Original HEI Report Submission/PM10_withps1990.Rda')
> load(file="~/PM10/pm10_withps1990_heiorig.Rda")
> ######## DO NOT Prune observations that are out of range ###########
> # dat=subset(dat, outofrange==0)
> ## Redefine pscat with unpruned observations
> nblock   <- 5
> breaks  <- as.numeric(quantile(dat$ps, probs = seq(from=0, to=1, by = 1/nblock)))
> dat$pscat  <- as.numeric(cut(dat$ps, breaks= breaks, include.lowest=T))
> dat$pscat = as.factor(dat$pscat)
> 
> 
> ######## Set the Working Directory so that output is saved in the right place ######## 
> wd <- "~/PM10/20150904_HEIorig_noprune_pollution/"
> setwd(wd)
> 
> ##############################################################
> ################ Specify the Array Parameters ################
> ##############################################################
> ytrans = c("log", "change", "95") 
> 
> ##############################################################
> ###################### Array Starts Here #####################
> ##############################################################
> j = as.numeric(Sys.getenv('SLURM_ARRAY_TASK_ID'))
> print(j)
[1] 2
> 
> 
> library(splines)
> library(HEIfunctions)
> library(coda)
> library(corpcor)
> 
> ######## Choose how to transform pollution ######## 
> if (ytrans[j]=="log")
+   dat$y = log(dat$pm10fu)   
> if (ytrans[j]=="change")
+   dat$y = dat$pm10fu - dat$pm10base1990
> if (ytrans[j]=="95")
+   dat$y = log(dat$pm10fu95)
> 
> 
> 
> ######## Choose how to specify the model ######## 
> ### Big Models ###
> vars = c("Monitor", "a", "Median_income", "HS_rate", "Urban_rate", "Migration_5_year_rate", "Hispanic_cens", "White_cens", "Black_cens",
+          "Current_Smoking_rate_weighted", "Female_cens", "mean_age.2001", "Female_rate.2001", "White_rate.2001", "Black_rate.2001",
+          "Tot_Beneficiary.2001", "pm10base1990", "housedens", "temperature", "logpop")
> ## Use all the variables listed above except the census ones that are duplciated in medicare
> my=glm(y~pscat + pm10base1990 + Tot_Beneficiary.2001 + Median_income + HS_rate + Urban_rate + Migration_5_year_rate + Current_Smoking_rate_weighted + mean_age.2001 + Female_rate.2001 + White_rate.2001 + Black_rate.2001 + housedens + temperature + logpop, 
+        data=dat)
> formula = my$formula
> 
> coords 	<- cbind(dat$Longitude, dat$Latitude)
> 
> phistart 	<- makephi(coords, 10)
> philower 	<- makephi(coords, 4)
> phiupper 	<- makephi(coords, 30)
> 
> tuning 	<- list(A = 0.1, psi = 0.2, theta = 1)
> prior 		<- list(KIG = rep(.5,2), psi = rep(.5,2), theta1 = rep(philower, 2), theta2 = rep(phiupper,2))
> starting 	<- list(B=NULL, A = NULL, psi = NULL, theta = phistart)
> 
> mod 		<- mvpsmod(formula, dat, "a", coords, nsamp=50000, thin=1,
+ 			tuning=tuning, prior=prior, starting=starting, 
+       outputbinsize = 500, outputfilename = paste("pollutionmodel_temp_", ytrans[j],".Rda", sep=""))
Loading required package: spBayes
Loading required package: magic
Loading required package: abind
Loading required package: Formula
Loading required package: MASS
[1] "Note: function does not accept missing data in covariates."
[1] "Iteration: 1000"
[1] "Accepted:" "0.326"     "0.299"     "0.326"     "0.299"     "0.326"    
[7] "0.299"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 2000"
[1] "Accepted:" "0.324"     "0.304"     "0.324"     "0.304"     "0.324"    
[7] "0.304"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 3000"
[1] "Accepted:" "0.328"     "0.311"     "0.328"     "0.311"     "0.328"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 4000"
[1] "Accepted:" "0.316"     "0.31"      "0.316"     "0.31"      "0.316"    
[7] "0.31"     
[1] "Number of not PD:" "0"                
[1] "Iteration: 5000"
[1] "Accepted:" "0.311"     "0.306"     "0.311"     "0.306"     "0.311"    
[7] "0.306"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 6000"
[1] "Accepted:" "0.308"     "0.308"     "0.308"     "0.308"     "0.308"    
[7] "0.308"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 7000"
[1] "Accepted:" "0.308"     "0.307"     "0.308"     "0.307"     "0.308"    
[7] "0.307"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 8000"
[1] "Accepted:" "0.306"     "0.309"     "0.306"     "0.309"     "0.306"    
[7] "0.309"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 9000"
[1] "Accepted:" "0.31"      "0.314"     "0.31"      "0.314"     "0.31"     
[7] "0.314"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 10000"
[1] "Accepted:" "0.309"     "0.312"     "0.309"     "0.312"     "0.309"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 11000"
[1] "Accepted:" "0.309"     "0.312"     "0.309"     "0.312"     "0.309"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 12000"
[1] "Accepted:" "0.309"     "0.311"     "0.309"     "0.311"     "0.309"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 13000"
[1] "Accepted:" "0.309"     "0.31"      "0.309"     "0.31"      "0.309"    
[7] "0.31"     
[1] "Number of not PD:" "0"                
[1] "Iteration: 14000"
[1] "Accepted:" "0.309"     "0.312"     "0.309"     "0.312"     "0.309"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 15000"
[1] "Accepted:" "0.308"     "0.313"     "0.308"     "0.313"     "0.308"    
[7] "0.313"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 16000"
[1] "Accepted:" "0.31"      "0.313"     "0.31"      "0.313"     "0.31"     
[7] "0.313"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 17000"
[1] "Accepted:" "0.311"     "0.313"     "0.311"     "0.313"     "0.311"    
[7] "0.313"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 18000"
[1] "Accepted:" "0.312"     "0.313"     "0.312"     "0.313"     "0.312"    
[7] "0.313"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 19000"
[1] "Accepted:" "0.311"     "0.312"     "0.311"     "0.312"     "0.311"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 20000"
[1] "Accepted:" "0.311"     "0.312"     "0.311"     "0.312"     "0.311"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 21000"
[1] "Accepted:" "0.309"     "0.311"     "0.309"     "0.311"     "0.309"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 22000"
[1] "Accepted:" "0.308"     "0.311"     "0.308"     "0.311"     "0.308"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 23000"
[1] "Accepted:" "0.309"     "0.311"     "0.309"     "0.311"     "0.309"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 24000"
[1] "Accepted:" "0.308"     "0.312"     "0.308"     "0.312"     "0.308"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 25000"
[1] "Accepted:" "0.308"     "0.31"      "0.308"     "0.31"      "0.308"    
[7] "0.31"     
[1] "Number of not PD:" "0"                
[1] "Iteration: 26000"
[1] "Accepted:" "0.309"     "0.311"     "0.309"     "0.311"     "0.309"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 27000"
[1] "Accepted:" "0.309"     "0.31"      "0.309"     "0.31"      "0.309"    
[7] "0.31"     
[1] "Number of not PD:" "0"                
[1] "Iteration: 28000"
[1] "Accepted:" "0.309"     "0.31"      "0.309"     "0.31"      "0.309"    
[7] "0.31"     
[1] "Number of not PD:" "0"                
[1] "Iteration: 29000"
[1] "Accepted:" "0.308"     "0.31"      "0.308"     "0.31"      "0.308"    
[7] "0.31"     
[1] "Number of not PD:" "0"                
[1] "Iteration: 30000"
[1] "Accepted:" "0.309"     "0.311"     "0.309"     "0.311"     "0.309"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 31000"
[1] "Accepted:" "0.309"     "0.311"     "0.309"     "0.311"     "0.309"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 32000"
[1] "Accepted:" "0.309"     "0.311"     "0.309"     "0.311"     "0.309"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 33000"
[1] "Accepted:" "0.31"      "0.311"     "0.31"      "0.311"     "0.31"     
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 34000"
[1] "Accepted:" "0.31"      "0.311"     "0.31"      "0.311"     "0.31"     
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 35000"
[1] "Accepted:" "0.31"      "0.311"     "0.31"      "0.311"     "0.31"     
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 36000"
[1] "Accepted:" "0.31"      "0.311"     "0.31"      "0.311"     "0.31"     
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 37000"
[1] "Accepted:" "0.31"      "0.311"     "0.31"      "0.311"     "0.31"     
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 38000"
[1] "Accepted:" "0.309"     "0.311"     "0.309"     "0.311"     "0.309"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 39000"
[1] "Accepted:" "0.309"     "0.311"     "0.309"     "0.311"     "0.309"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 40000"
[1] "Accepted:" "0.308"     "0.311"     "0.308"     "0.311"     "0.308"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 41000"
[1] "Accepted:" "0.308"     "0.311"     "0.308"     "0.311"     "0.308"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 42000"
[1] "Accepted:" "0.307"     "0.312"     "0.307"     "0.312"     "0.307"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 43000"
[1] "Accepted:" "0.308"     "0.312"     "0.308"     "0.312"     "0.308"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 44000"
[1] "Accepted:" "0.308"     "0.312"     "0.308"     "0.312"     "0.308"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 45000"
[1] "Accepted:" "0.308"     "0.312"     "0.308"     "0.312"     "0.308"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 46000"
[1] "Accepted:" "0.308"     "0.312"     "0.308"     "0.312"     "0.308"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 47000"
[1] "Accepted:" "0.308"     "0.311"     "0.308"     "0.311"     "0.308"    
[7] "0.311"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 48000"
[1] "Accepted:" "0.308"     "0.312"     "0.308"     "0.312"     "0.308"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 49000"
[1] "Accepted:" "0.308"     "0.312"     "0.308"     "0.312"     "0.308"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
[1] "Iteration: 50000"
[1] "Accepted:" "0.308"     "0.312"     "0.308"     "0.312"     "0.308"    
[7] "0.312"    
[1] "Number of not PD:" "0"                
> 
> save(mod, file = paste("pollutionmod_", ytrans[j], ".Rda", sep=""))
> 
> 
> 
> 
> 
> 
> proc.time()
      user     system    elapsed 
257237.665     95.682 271908.166 
